package com.demo.provider.service.impl;

import api.DemoService;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.apache.dubbo.config.annotation.Service;

@Service
public class DemoServiceImpl implements DemoService {

    @NacosValue(value = "${nacos.test}", autoRefreshed = true)
    private String serviceName;
//
//    @NacosInjected
//	private ConfigService configService;
//    
//    @Override
//    public String sayHello(String name) {
//    	System.out.println("你好！我收到消息了:"+name+"集中控制："+config);
//    	
//    	try {
//    		System.out.println("修改之前："+ configService.getConfig("dubbo-provider", "DEFAULT_GROUP", 500));
////			configService.publishConfig("dubbo-provider", "DEFAULT_GROUP", "application.yml");//配置属性（例如：nacos.test: 11111）
//    		configService.publishConfig("dubbo-provider", "DEFAULT_GROUP", config);//配置属性
//			System.out.println("修改之后："+ configService.getConfig("dubbo-consumer", "DEFAULT_GROUP", 500));
//		} catch (NacosException e) {
//			e.printStackTrace();
//		}
//    	
//        return String.format("[%s] : Hello, %s", serviceName, name, config);
//    }
    
    @Override
    public String sayHello(String name) {
        System.out.println("serviceName:"+serviceName);
    	System.out.println("你好！我收到消息了:"+name+"集中控制：");
        return String.format("[%s] : Hello, %s", serviceName, name);
    }
}
